package linpeng.service;

import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;

import linpeng.util.StreamTool;


public class WebService {
	public static byte[] getImage(String path){
		//haha
		URL url;
		byte[] b=null;
		try {
			url = new URL(path);   
			HttpURLConnection con;
			
		    con = (HttpURLConnection)url.openConnection();  
		    
			con.setRequestMethod("GET");  
			
			con.setConnectTimeout(5000);
			InputStream in=con.getInputStream();   
			
		    b=StreamTool.readInputStream(in);
			
		} catch (Exception e) {
			
			e.printStackTrace();
		}
		return b;   
		
	}
	
}